<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
      
        
        ul li{
            perspective: 500px;
            list-style: none;
            float: left;
            height: 40px;
            width: 120px;
           
          
        }

        .box {
            position: relative;
            height: 40px;
            width: 120px;
            transform-style: preserve-3d;
            transition: all 1s;
      


        }

        .box div {
            position: absolute;
            left: 0;
            top: 0;
            height: 100%;
            width: 100%;


        }

        .box div:first-child {
            background-color: pink;
            z-index: 1;
            transform: translateZ(20px);
        }

        .box div:last-child {
            background-color: yellow;
            transform: translateY(20px) rotateX(-90deg);

        }

        .box:hover {
            transform: rotateX(90deg);
            transform-origin: bottom;
        }
    </style>
</head>

<body>
    <ul>
        <li>
            <div class="box">
                <div></div>
                <div></div>
            </div>
        </li>
        <li>
            <div class="box">
                <div></div>
                <div></div>
            </div>
        </li>
        <li>
            <div class="box">
                <div></div>
                <div></div>
            </div>
        </li>
        <li>
            <div class="box">
                <div></div>
                <div></div>
            </div>
        </li>
        <li>
            <div class="box">
                <div></div>
                <div></div>
            </div>
        </li>
        <li>
            <div class="box">
                <div></div>
                <div></div>
            </div>
        </li>
        <li>
            <div class="box">
                <div></div>
                <div></div>
            </div>
        </li>
    </ul>
</body>

</html>